﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using University.Workshop.DataAccess;

namespace University.Workshop.Business
{
    public class ManagerCharges
    {

        public static void NewCharge(Model.WaterCollectControl newExpense)
        {
            /*newExpense.CollectPayDate = DateTime.Now;
            //newExpense.UserId = 

            DataAccessCollectControl.UpdateCharge(newExpense);*/
        }




        public static ICollection<Model.WaterCollectControl> SearchChargeByParameter(Model.WaterCollectControl chargetoFind)
        {
            ICollection<Model.WaterCollectControl> c;
            c = DataAccessCollectControl.SearchExpenseByParameterAll(chargetoFind);

            if (c.Count == 0)
            {
                throw new Exception("No se encontraron resultados de la busqueda...");
            }
            foreach (Model.WaterCollectControl charge in c)
            {
                //if (charge.CollectIsPaid == 0 || charge.CollectIsPaid == 2)
                //    charge.Paid = true;
                //else
                //    charge.Paid = false;
            }
            return c;
        }


        public static ICollection<Model.WaterCollectControl> SearchChargeMinusDate(Model.WaterCollectControl chargetoFind)
        {
            ICollection<Model.WaterCollectControl> c;
            c = DataAccessCollectControl.SearchExpenseMinusDatePurchase(chargetoFind);

            if (c.Count == 0)
            {
                throw new Exception("No se encontraron resultados de la busqueda...");
            }
            foreach (Model.WaterCollectControl charge in c)
            {
                //if (charge.CollectIsPaid == 0 || charge.CollectIsPaid == 2)
                //    charge.Paid = true;
                //else
                //    charge.Paid = false;
            }
            return c;
        }
    }
}
